cmake_minimum_required(VERSION 3.12.4)


project(widget_demo)

# 添加调试标志
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -rdynamic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -rdynamic")

# 添加驱动编译选项
option(ENABLE_DRIVERS "Enable building drivers" OFF)

set(LV_CONF_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lv_conf.h CACHE STRING "Path defined for lv_conf.h")



file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

add_executable(${PROJECT_NAME} ${SOURCES})

target_link_libraries(${PROJECT_NAME} PRIVATE pthread)

# 链接 LVGL 库
target_link_libraries(${PROJECT_NAME} PRIVATE lvgl)

# 链接 lv_drivers 库
target_link_libraries(${PROJECT_NAME} PRIVATE lv_drivers)

target_link_libraries(${PROJECT_NAME} PRIVATE lvgl_demos)


set_target_properties(
  ${PROJECT_NAME}
  PROPERTIES OUTPUT_NAME ${PROJECT_NAME}
             RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

install(TARGETS ${PROJECT_NAME} DESTINATION bin)